import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yp/Xwidgets/index.dart';
import 'package:yp/helper.dart';
import 'package:yp/pages/mall_app/turntable_aword/logic.dart';
import 'package:yp/pages/mall_app/turntable_aword/state.dart';
import 'package:yp/pages/mall_app/turntable_aword/views/brief.dart';
import 'package:yp/pages/mall_app/turntable_aword/views/tab.dart';

import 'views/awart.dart';

class TurntableAwardPage extends StatefulWidget {
  const TurntableAwardPage({Key key}) : super(key: key);

  @override
  _TurntableAwardPageState createState() => _TurntableAwardPageState();
}

class _TurntableAwardPageState extends State<TurntableAwardPage> {
  final logic = Get.put(TurntableAwardLogic());
  final TurntableAwardState state = Get.find<TurntableAwardLogic>().state;
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: YPXNavigationBar('大转盘'),
      backgroundColor: Color(0xffF1364E),
      body: Padding(
        padding: EdgeInsets.fromLTRB(
            setWidth(20), 0, setWidth(20), setWidth(50) + Get.bottomBarHeight),
        child: Column(
          children: [
            SizedBox(
              height: setWidth(40),
            ),
            TurntableTabBar(),
            Expanded(
                child: Container(
              padding: EdgeInsets.symmetric(
                  horizontal: setWidth(20), vertical: setWidth(50)),
              decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadiusDirectional.vertical(
                      bottom: Radius.circular(setWidth(20)))),
              child: GetBuilder<TurntableAwardLogic>(
                  builder: (logic) => state.currentIndex == 0
                      ? TurntableBriefView()
                      : TurntableAwardView()),
            ))
          ],
        ),
      ),
    );
  }
}
